class Game extends egret.DisplayObjectContainer{
	private bmp:egret.Bitmap;
	private sp:egret.Shape;
	private bmp_b:egret.Bitmap;
	private bmp_test:egret.Bitmap;
	public constructor() {
		super();
		
		this.sp=new egret.Shape();
		this.sp.graphics.beginFill(0x0,1)
		this.sp.graphics.drawRect(0,0,740,1136);
		this.addChild(this.sp);

		this.bmp=new egret.Bitmap();
		this.bmp.texture=RES.getRes('t1_png');
		this.bmp.anchorOffsetX=this.bmp.width/2;
		this.bmp.anchorOffsetY=this.bmp.height/2;
		this.bmp.x=740/2;
		this.bmp.y=1136/2;
		this.addChild(this.bmp);

		this.bmp_test=new egret.Bitmap();
		this.bmp_test.texture=RES.getRes('back_png');
		this.bmp_test.anchorOffsetX=this.bmp_test.width/2;
		this.bmp_test.anchorOffsetY=this.bmp_test.height/2;
		
		this.addChild(this.bmp_test);
		this.bmp_test.touchEnabled=true;
		this.bmp_test.addEventListener(egret.TouchEvent.TOUCH_BEGIN,this.touchHandler,this);
		console.log(':::::::::::::::',window.innerWidth);
		// this.bmp_test.x=window.innerWidth-this.bmp_test.width/2-35;
		this.bmp_test.x=740-this.bmp_test.width/2-45;
		this.bmp_test.y=0+this.bmp_test.height/2+35;

		// this.bmp_b=new egret.Bitmap();
		// this.bmp_b=RES.getRes('back_png');
		// this.bmp_b.anchorOffsetX=this.bmp_b.width/2;
		// this.bmp_b.anchorOffsetY=this.bmp_b.height/2;
		// this.bmp_b.x=740-this.bmp_b.width/2-20;
		// this.bmp_b.y=740-this.bmp_b.height/2-20;
		// this.addChild(this.bmp_b);
		this.addEventListener(egret.Event.ADDED_TO_STAGE,this.addToStage,this);
	}
	private addToStage(e:egret.Event):void
	{
		
	}
	public In(idx:string):void
	{
		this.sp.alpha=0;
		this.sp.y=-1136;
		egret.Tween.get(this.sp).to({y:0,alpha:0.7},1000,egret.Ease.cubicInOut);
		
		this.bmp.texture=RES.getRes('t'+idx+'_png')
		this.bmp.scaleX=this.bmp.scaleY=0;
		egret.Tween.get(this.bmp).wait(500).to({scaleX:1,scaleY:1},1000,egret.Ease.backOut);

		this.bmp_test.scaleX=this.bmp_test.scaleY=0;
		egret.Tween.get(this.bmp_test).wait(1500).to({scaleX:1,scaleY:1},1000,egret.Ease.backOut);
	}
	private touchHandler(e:egret.TouchEvent):void
	{
		e.stopPropagation();
		e.stopImmediatePropagation();
		console.log(e.type)
		if(e.type=='touchBegin')
		{
			this.parent['Out']();
			this.parent.removeChild(this);
		}
	}
}